{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "dotnet_interactive": {
     "language": "csharp"
    },
    "polyglot_notebook": {
     "kernelName": "csharp"
    }
   },
   "outputs": [],
   "source": [
    "#load \"..\\Extension\\LoadBaseTool.csx\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "由于在 Notebook 中无法定义扩展方法，因此只能以 markdown 形式表达。\n",
    "\n",
    "来源：https://www.bilibili.com/video/BV1RR4y1r7vj\n",
    "\n",
    "```csharp\n",
    "public static class TempExtension\n",
    "{\n",
    "    public static TaskAwaiter GetAwaiter(this TimeSpan _time_span)\n",
    "    => Task.Delay(_time_span).GetAwaiter();\n",
    "\n",
    "    public static TaskAwaiter GetAwaiter(this int _seconds)\n",
    "    => Task.Delay(TimeSpan.FromSeconds(_seconds)).GetAwaiter();\n",
    "}\n",
    "\n",
    "\n",
    "await TimeSpan.FromSecond(2);\n",
    "await 2;\n",
    "```\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".NET (C#)",
   "language": "C#",
   "name": ".net-csharp"
  },
  "language_info": {
   "name": "polyglot-notebook"
  },
  "polyglot_notebook": {
   "kernelInfo": {
    "defaultKernelName": "csharp",
    "items": [
     {
      "aliases": [],
      "languageName": "csharp",
      "name": "csharp"
     }
    ]
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
